Notion Functions

Notion provides a vast array of functions capable of some extremely powerful stuffs.

The table below provides description of all the functions notion provides.

abs#

Returns the absolute value of a number

ArityResult typeExample (Function)Example (Operator)
(number)numberabs(1)null

add#

Adds two numbers and returns their sum, or concatenates two strings.

ArityResult typeExample (Function)Example (Operator)
(text,text)textadd("text", "text")"text" + "text"
(number,number)numberadd(1, 1)1 + 1

and#

Returns the logical AND of its two arguments.

ArityResult typeExample (Function)Example (Operator)
(checkbox,checkbox)checkboxand(true, true)true and true

cbrt#

Returns the cube root of a number.

ArityResult typeExample (Function)Example (Operator)
(number)numbercbrt(1)null

ceil#

Returns the smallest integer greater than or equal to a number.

ArityResult typeExample (Function)Example (Operator)
(number)numberceil(1)null

concat#

Concatenates its arguments and returns the result.

ArityResult typeExample (Function)Example (Operator)
(text)textconcat("text")null

contains#

Returns true if the second argument is found in the first.

ArityResult typeExample (Function)Example (Operator)
(text,text)checkboxcontains("text", "text")null

date#

Returns an integer number, between 1 and 31, corresponding to day of the month for the given.

ArityResult typeExample (Function)Example (Operator)
(date)numberdate(now())null

dateAdd#

Add to a date. The last argument, unit, can be one of: "years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", or "milliseconds".

ArityResult typeExample (Function)Example (Operator)
(date,number,text)datedateAdd(now(), 1, "seconds")null

dateBetween#

Returns the time between two dates. The last argument, unit, can be one of: "years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", or "milliseconds".

ArityResult typeExample (Function)Example (Operator)
(date,date,text)numberdateBetween(now(), now(), "seconds")null

dateSubtract#

Subtract from a date. The last argument, unit, can be one of: "years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", or "milliseconds".

ArityResult typeExample (Function)Example (Operator)
(date,number,text)datedateSubtract(now(), 1, "seconds")null

day#

Returns an integer number corresponding to the day of the week for the given date: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on.

ArityResult typeExample (Function)Example (Operator)
(date)numberday(now())null

divide#

Divides two numbers and returns their quotient.

ArityResult typeExample (Function)Example (Operator)
(number,number)numberdivide(1, 1)1 / 1

empty#

Tests if a value is empty.

ArityResult typeExample (Function)Example (Operator)
(text)checkboxempty("text")null
(number)checkboxempty(1)null
(checkbox)checkboxempty(true)null
(date)checkboxempty(now())null

end#

Returns the end of a date range.

ArityResult typeExample (Function)Example (Operator)
(date)dateend(now())null

equal#

Returns true if its arguments are equal, and false otherwise.

ArityResult typeExample (Function)Example (Operator)
(number,number)checkboxequal(1, 1)1 == 1
(text,text)checkboxequal("text", "text")"text" == "text"
(checkbox,checkbox)checkboxequal(true, true)true == true
(date,date)checkboxequal(now(), now())now() == now()

exp#

Returns E^x, where x is the argument, and E is Euler's constant (2.718…), the base of the natural logarithm.

ArityResult typeExample (Function)Example (Operator)
(number)numberexp(1)null

floor#

Returns the largest integer less than or equal to a number.

ArityResult typeExample (Function)Example (Operator)
(number)numberfloor(1)null

format#

Formats its argument as a string.

ArityResult typeExample (Function)Example (Operator)
(text)textformat("text")null
(date)textformat(now())null
(number)textformat(1)null
(checkbox)textformat(true)null

formatDate#

Format a date using the Moment standard time format string.

ArityResult typeExample (Function)Example (Operator)
(date,text)textformatDate(now(), "text")null

fromTimestamp#

Returns a date constructed from a Unix millisecond timestamp, corresponding to the number of milliseconds since January 1, 1970.

ArityResult typeExample (Function)Example (Operator)
(number)datefromTimestamp(1)null

hour#

Returns an integer number, between 0 and 23, corresponding to hour for the given date.

ArityResult typeExample (Function)Example (Operator)
(date)numberhour(now())null

if#

Switches between two options based on another value.

ArityResult typeExample (Function)Example (Operator)
(checkbox,number,number)numberif(true, 1, 1)null
(checkbox,text,text)textif(true, "text", "text")null
(checkbox,checkbox,checkbox)checkboxif(true, true, true)null
(checkbox,date,date)dateif(true, now(), now())null

join#

Inserts the first argument between the rest and returns their concatenation.

ArityResult typeExample (Function)Example (Operator)
(text)textjoin("text")null

larger#

Returns true if the first argument is larger than the second.

ArityResult typeExample (Function)Example (Operator)
(number,number)checkboxlarger(1, 1)1 > 1
(text,text)checkboxlarger("text", "text")"text" > "text"
(checkbox,checkbox)checkboxlarger(true, true)true > true
(date,date)checkboxlarger(now(), now())now() > now()

largerEq#

Returns true if the first argument is larger than or equal to than the second.

ArityResult typeExample (Function)Example (Operator)
(number,number)checkboxlargerEq(1, 1)1 >= 1
(text,text)checkboxlargerEq("text", "text")"text" >= "text"
(checkbox,checkbox)checkboxlargerEq(true, true)true >= true
(date,date)checkboxlargerEq(now(), now())now() >= now()

length#

Returns the length of a string.

ArityResult typeExample (Function)Example (Operator)
(text)numberlength("text")null

ln#

Returns the natural logarithm of a number.

ArityResult typeExample (Function)Example (Operator)
(number)numberln(1)null

log10#

Returns the base 10 logarithm of a number.

ArityResult typeExample (Function)Example (Operator)
(number)numberlog10(1)null

log2#

Returns the base 2 logarithm of a number.

ArityResult typeExample (Function)Example (Operator)
(number)numberlog2(1)null

max#

Returns the largest of zero or more numbers.

ArityResult typeExample (Function)Example (Operator)
(number)numbermax(1)null

min#

Returns the smallest of zero or more numbers.

ArityResult typeExample (Function)Example (Operator)
(number)numbermin(1)null

minute#

Returns an integer number, between 0 and 59, corresponding to minutes in the given date.

ArityResult typeExample (Function)Example (Operator)
(date)numberminute(now())null

mod#

Divides two numbers and returns their remainder.

ArityResult typeExample (Function)Example (Operator)
(number,number)numbermod(1, 1)1 % 1

month#

Returns an integer number, between 0 and 11, corresponding to month in the given date according to local time. 0 corresponds to January, 1 to February, and so on.

ArityResult typeExample (Function)Example (Operator)
(date)numbermonth(now())null

multiply#

Multiplies two numbers and returns their product.

ArityResult typeExample (Function)Example (Operator)
(number,number)numbermultiply(1, 1)1 * 1

not#

Returns the logical NOT of its argument.

ArityResult typeExample (Function)Example (Operator)
(checkbox)checkboxnot(true)not true

now#

Returns the current date and time.

ArityResult typeExample (Function)Example (Operator)
()datenow()null

or#

Returns the logical OR of its two arguments.

ArityResult typeExample (Function)Example (Operator)
(checkbox,checkbox)checkboxor(true, true)true or true

pow#

Returns base to the exponent power, that is, baseexponent.

ArityResult typeExample (Function)Example (Operator)
(number,number)numberpow(1, 1)1 ^ 1

replace#

Replaces the first match of a regular expression with a new value.

ArityResult typeExample (Function)Example (Operator)
(text,text,text)textreplace("text", "text", "text")null
(number,text,text)textreplace(1, "text", "text")null
(checkbox,text,text)textreplace(true, "text", "text")null

replaceAll#

Replaces all matches of a regular expression with a new value.

ArityResult typeExample (Function)Example (Operator)
(text,text,text)textreplaceAll("text", "text", "text")null
(number,text,text)textreplaceAll(1, "text", "text")null
(checkbox,text,text)textreplaceAll(true, "text", "text")null

round#

Returns the value of a number rounded to the nearest integer.

ArityResult typeExample (Function)Example (Operator)
(number)numberround(1)null

sign#

Returns the sign of the x, indicating whether x is positive, negative or zero.

ArityResult typeExample (Function)Example (Operator)
(number)numbersign(1)null

slice#

Extracts a substring from a string from the start index (inclusively) to the end index (optional and exclusively).

ArityResult typeExample (Function)Example (Operator)
(text,number)textslice("text", 1)null
(text,number,number)textslice("text", 1, 1)null

smaller#

Returns true if the first argument is smaller than the second.

ArityResult typeExample (Function)Example (Operator)
(number,number)checkboxsmaller(1, 1)1 < 1
(text,text)checkboxsmaller("text", "text")"text" < "text"
(checkbox,checkbox)checkboxsmaller(true, true)true < true
(date,date)checkboxsmaller(now(), now())now() < now()

smallerEq#

Returns true if the first argument is smaller than or equal to than the second.

ArityResult typeExample (Function)Example (Operator)
(number,number)checkboxsmallerEq(1, 1)1 <= 1
(text,text)checkboxsmallerEq("text", "text")"text" <= "text"
(checkbox,checkbox)checkboxsmallerEq(true, true)true <= true
(date,date)checkboxsmallerEq(now(), now())now() <= now()

sqrt#

Returns the positive square root of a number.

ArityResult typeExample (Function)Example (Operator)
(number)numbersqrt(1)null

start#

Returns the start of a date range.

ArityResult typeExample (Function)Example (Operator)
(date)datestart(now())null

subtract#

Subtracts two numbers and returns their difference.

ArityResult typeExample (Function)Example (Operator)
(number,number)numbersubtract(1, 1)1 - 1

test#

Tests if a string matches a regular expression.

ArityResult typeExample (Function)Example (Operator)
(text,text)checkboxtest("text", "text")null
(number,text)checkboxtest(1, "text")null
(checkbox,text)checkboxtest(true, "text")null

timestamp#

Returns an integer number from a Unix millisecond timestamp, corresponding to the number of milliseconds since January 1, 1970.

ArityResult typeExample (Function)Example (Operator)
(date)numbertimestamp(now())null

toNumber#

Parses a number from text.

ArityResult typeExample (Function)Example (Operator)
(text)numbertoNumber("text")null
(date)numbertoNumber(now())null
(number)numbertoNumber(1)null
(checkbox)numbertoNumber(true)null

unaryMinus#

Negates a number.

ArityResult typeExample (Function)Example (Operator)
(number)numberunaryMinus(1)- 1

unaryPlus#

Converts its argument into a number.

ArityResult typeExample (Function)Example (Operator)
(checkbox)numberunaryPlus(true)+ true
(text)numberunaryPlus("text")+ "text"
(number)numberunaryPlus(1)+ 1

unequal#

Returns false if its arguments are equal, and true otherwise.

ArityResult typeExample (Function)Example (Operator)
(number,number)checkboxunequal(1, 1)1 != 1
(text,text)checkboxunequal("text", "text")"text" != "text"
(checkbox,checkbox)checkboxunequal(true, true)true != true
(date,date)checkboxunequal(now(), now())now() != now()

year#

Returns a number corresponding to the year of the given date.

ArityResult typeExample (Function)Example (Operator)
(date)numberyear(now())null
Last updated on